/**
 * <copyright>
 * </copyright>
 *
 */
package co.edu.unal.research.contentprovider.contentProviderDsl.impl;

import co.edu.unal.research.contentprovider.contentProviderDsl.Configuration;
import co.edu.unal.research.contentprovider.contentProviderDsl.ContentProvider;
import co.edu.unal.research.contentprovider.contentProviderDsl.ContentProviderDslPackage;
import co.edu.unal.research.contentprovider.contentProviderDsl.Table;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Content Provider</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link co.edu.unal.research.contentprovider.contentProviderDsl.impl.ContentProviderImpl#getConfig <em>Config</em>}</li>
 *   <li>{@link co.edu.unal.research.contentprovider.contentProviderDsl.impl.ContentProviderImpl#getTables <em>Tables</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ContentProviderImpl extends MinimalEObjectImpl.Container implements ContentProvider
{
  /**
   * The cached value of the '{@link #getConfig() <em>Config</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getConfig()
   * @generated
   * @ordered
   */
  protected EList<Configuration> config;

  /**
   * The cached value of the '{@link #getTables() <em>Tables</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTables()
   * @generated
   * @ordered
   */
  protected EList<Table> tables;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ContentProviderImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ContentProviderDslPackage.Literals.CONTENT_PROVIDER;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Configuration> getConfig()
  {
    if (config == null)
    {
      config = new EObjectContainmentEList<Configuration>(Configuration.class, this, ContentProviderDslPackage.CONTENT_PROVIDER__CONFIG);
    }
    return config;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Table> getTables()
  {
    if (tables == null)
    {
      tables = new EObjectContainmentEList<Table>(Table.class, this, ContentProviderDslPackage.CONTENT_PROVIDER__TABLES);
    }
    return tables;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ContentProviderDslPackage.CONTENT_PROVIDER__CONFIG:
        return ((InternalEList<?>)getConfig()).basicRemove(otherEnd, msgs);
      case ContentProviderDslPackage.CONTENT_PROVIDER__TABLES:
        return ((InternalEList<?>)getTables()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ContentProviderDslPackage.CONTENT_PROVIDER__CONFIG:
        return getConfig();
      case ContentProviderDslPackage.CONTENT_PROVIDER__TABLES:
        return getTables();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ContentProviderDslPackage.CONTENT_PROVIDER__CONFIG:
        getConfig().clear();
        getConfig().addAll((Collection<? extends Configuration>)newValue);
        return;
      case ContentProviderDslPackage.CONTENT_PROVIDER__TABLES:
        getTables().clear();
        getTables().addAll((Collection<? extends Table>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ContentProviderDslPackage.CONTENT_PROVIDER__CONFIG:
        getConfig().clear();
        return;
      case ContentProviderDslPackage.CONTENT_PROVIDER__TABLES:
        getTables().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ContentProviderDslPackage.CONTENT_PROVIDER__CONFIG:
        return config != null && !config.isEmpty();
      case ContentProviderDslPackage.CONTENT_PROVIDER__TABLES:
        return tables != null && !tables.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //ContentProviderImpl
